package org.BiteTheDice;

import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

/**
 * run about.xml when called
 * @author barakn01
 */
public class Help extends Activity implements Html.ImageGetter{

	public Drawable getDrawable (String source)
	{
		Bitmap B = null;
		if (source.equals("green"))
			B= BitmapFactory.decodeResource(getResources(),R.drawable.green3);
		else if (source.equals("red"))
			B= BitmapFactory.decodeResource(getResources(),R.drawable.red2);
		else if (source.equals("blue"))
			B= BitmapFactory.decodeResource(getResources(),R.drawable.blue4);
		else if (source.equals("white"))
			B= BitmapFactory.decodeResource(getResources(),R.drawable.white1border);
		else if (source.equals("yellow"))
			B= BitmapFactory.decodeResource(getResources(),R.drawable.yellow5);
		else if (source.equals("shield")){
			B= BitmapFactory.decodeResource(getResources(),R.drawable.hungry);
			BitmapDrawable BD = new BitmapDrawable(B);
			BD.setBounds(0,0,45,45);
			return BD;
		}
		BitmapDrawable BD = new BitmapDrawable(B);
		BD.setBounds(0,0,B.getWidth(),B.getHeight());
		return BD;
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.help);
		TextView cont=(TextView) findViewById(R.id.help_content);
	//new ScrollingMovementMethod();
	//cont.setMovementMethod(ScrollingMovementMethod.getInstance());		
		CharSequence helpText=Html.fromHtml(
		"Try to get as many points as you can in 2 minutes, by dragging" +
		" the white circle on the screen and biting dices.<br> " +
		"White dices will give you extra points, while red ones will reduce them!<br>" +
		"Collect Power Ups as you go.<br>"+
		"Do not take your finger off the circle- it will cost you points!" +
		"Each second your finger is not on the circle will reduce 5 points.<br>"+
		"<u><b>Single player:</b></u><br> " +
		"Best 10 scores are saved in the 'High Scores' table.<br>" +
		"You can share your scores with friends, by publishing " +
		"them on Facebook's Wall when the game ends.<br>" +
		"<u><b>Two players:\n</b></u><br>"+
		"Each player has his own circle on the screen.<br>"+
		"The goal is to get as many points as you can in 2 minutes, "+
		"while interrupting your opponent to receive points.<br>"+
		"<u><b>Power Ups:</b></u><br>"+
		"<img src=\"white\"/> White Dices give you 5 points <br>"+
		"<img src=\"red\"/> Red Dices will cost you 3 points <br>"+
		"<img src=\"green\"/> Green Dices will glue you for 3 seconds<br>"+
		"<img src=\"blue\"/> Blue Dices will slow all dices down for 6 seconds<br>"+
		"<img src=\"yellow\"/> Yellow Dices will give you double points for 5 seconds<br>"+
		"<img src=\"shield\"/> Colored Dices will shield you from bad dices for 5 seconds"
		,this,null);
		cont.setText(helpText);
	}
}